#include <stdio.h>

struct A
{
    unsigned char a : 2;//a只有2个bit大小
    // 11二进制
    unsigned char b : 4;//b是4个bit
    //char b : 4;//b是4个bit
    // 1111 二进制
};




int main0()
{
    struct A a;
    a.a = 3;
    printf("%x\n", a.a);
    a.b = 13;
    printf("%d\n", a.b);
    return 0;
}

//控制霓虹灯
//位数
struct B
{
    unsigned char a1 : 1;
    unsigned char a2 : 1;
    unsigned char a3 : 1;
    unsigned char a4 : 1;
    unsigned char a5 : 1;
    unsigned char a6 : 1;
    unsigned char a7 : 1;
    unsigned char a8 : 1;
};


int main()
{
    struct B b;
    printf("%lu\n", sizeof(b));
    b.a1 = 1;
    b.a2 = 0;
    b.a3 = 1;
    b.a4 = 0;
    b.a5 = 1;
    b.a6 = 0;
    b.a7 = 1;
    b.a8 = 0;
}
